{#继承父页面#}
{% extends 'module.html' %}
{#重写content#}
{% block content %}
    <div class="content-table">
        <h2>1.消防转输系统供水泵计算</h2>
        <label class="h3label">a.消防转输系统供水泵流量：</label>
        <input type="text" id="t_flow" name="t_flow" style="width:100px" value="{{ p.t_flow }}" onchange="totalFlow()"/>
        <label>L/s</label>
        <input type='button' class="btn-primary" value='保存' onclick="save1()"/>
        <!--输入，参数t_flow-->
        <h3>b.消防转输系统供水泵扬程</h3>
        <p>1).管网水头损失的计算</p>
        <!--表7.1-1-->
        <!--管道阻力合计SUM(m6.0.J)，参数sum_prt t22-->
        <div id="table{{ tables.0.id }}"></div>
        <div>
            <input type='button' class="btn-primary" value='新增' onclick="addrow{{ tables.0.id }}()"/>
            <input type='button' class="btn-primary" value='保存' onclick="submit{{ tables.0.id }}()"/>
        </div>
        <p style="padding-top: 10px">2).水泵扬程的计算</p>
        <!--表7.1-2-->
        <!--选泵扬程m6.1.I.0，参数t_pl t23-->
        <div id="table{{ tables.1.id }}"></div>
        <div>
            <input type='button' class="btn-primary" value='新增' style="display:none;" onclick="addrow{{ tables.1.id }}()"/>
            <input type='button' class="btn-primary" value='保存' onclick="submit{{ tables.1.id }}()"/>
        </div>

        <h3>c.消防转输系统供水泵选型</h3>
        <!--表7.1-3-->
        <div id="table{{ tables.2.id }}"></div>
        <div>
            <input type='button' class="btn-primary" value='新增' style="display:none;" onclick="addrow{{ tables.2.id }}()"/>
            <input type='button' class="btn-primary" value='保存' onclick="submit{{ tables.2.id }}()"/>
        </div>
        {% csrf_token %}
    </div>
{% endblock %}


{% block extrajs %}
    {{ block.super }}
    <script>
        function totalFlow() {
            var flow=document.getElementById('t_flow');
            var v = flow.value
            if(table22.setValue != undefined){
                let rows = table22.rows.length
                for(let i=1;i<rows;i++){
                    table22.setValue('B'+i,v);
                }
            }
        }
        //提交保存
        function save1() {
            var csrf = $("input[name='csrfmiddlewaretoken']").val()
            $.post("{% url 'project_save' p.id %}", {name: 't_flow', value: $("#t_flow").val(), csrfmiddlewaretoken: csrf}, function (result) {
                $.globalMessenger().post({
                message: result.data,
                hideAfter: 5,
                type: result.msg,
                //showCloseButton: true
                });
            })
        }
    </script>
{% endblock %}